export function download(res, name) {
    let temp = name || res.headers['content-disposition']
      ?.split(';')[1]
      ?.split('=')[1]
    const blob = new Blob([res.data], {
      type: 'charset=utf-8'
    })
    if (!name) {
      temp = temp.replace(/\"/g, "");
      temp = decodeURI(temp)
    }
    const downloadElement = document.createElement('a')
    const href = window.URL.createObjectURL(blob)
    downloadElement.href = href
    downloadElement.download = temp
    document.body.appendChild(downloadElement)
    downloadElement.click()
    document.body.removeChild(downloadElement)
    window.URL.revokeObjectURL(href)
  }